igloo

Installation d'une Gentoo sur un FitLet2 Compulab

Celeron J3455
2Go DDR3
16Go eMMC

Si vous avez besoin d'effectuer l'installation via ssh (par exemple, pour profiter de votre clavier bépo ou pour faire facilement des copier/coller) :

# passwd
# useradd -m -G users,wheel rod
# passwd rod
# rc-service sshd start
# ip a

On y coupera pas, on utilise l'UEFI
Table de partition utilisée :

BIOS2Mo
/boot128Mofat32
swap2048Mosw
/reste du disqueext4

Préparation du disque :

# parted -a optimal /dev/mmcblk0
(parted)mklabel gpt
(parted)unit mib
(parted)mkpart primary 1 3
(parted)name 1 grub
(parted)set 1 bios_grub on
(parted)mkpart primary 3 131
(parted)name 2 boot
(parted)set 2 boot on
(parted)mkpart primary 131 2179
(parted)name 3 swap
(parted)mkpart primary 2179 -1
(parted)name 4 rootfs
(parted)print
(parted)quit

# mkfs.fat -F 32 /dev/mmcblk0p2
# mkfs.ext4 /dev/mmcblk0p4
# mkswap /dev/mmcblk0p3

-Si vous devez reprendre votre installation, repartez d'ici

# swapon /dev/mmcblk0p3
# mount /dev/mmcblk0p4 /mnt/gentoo

On note les ID des partitions, on va en avoir besoin pour la configuration du noyau et la création du fichier fstab et on met le système à l'heure :

# blkid
# ntpd -q -g
# cd /mnt/gentoo

Choissez l'archive sur la page suivante (j'utilise la version 'hardened' pour ce tuto) et copiez le lien :

https://www.gentoo.org/downloads/#other-arches

Téléchargez l'archive et décompressez-la :

# wget <PASTED_STAGE_URL>
# tar xpvf stage3-*.tar.bz2 --xattrs-include='*.*' --numeric-owner

On édite le fichier make.conf ("-j5" correspond au nombre de cœur de votre machine plus un)

# emacs /mnt/gentoo/etc/portage/make.conf

COMMON_FLAGS="-march=native -O2 -pipe"
CFLAGS="${COMMON_FLAGS}"
CXXFLAGS="${COMMON_FLAGS}"
MAKEOPTS="-j5"

On sélectionne des miroirs dans la liste (je prends tous les français)

# mirrorselect -i -o >> /mnt/gentoo/etc/portage/make.conf

On monte quelques systèmes de fichier nécessaire à Gentoo

# mkdir --parents /mnt/gentoo/etc/portage/repos.conf
# cp /mnt/gentoo/usr/share/portage/config/repos.conf /mnt/gentoo/etc/portage/repos.conf/gentoo.conf
# cp --dereference /etc/resolv.conf /mnt/gentoo/etc/
# mount --types proc /proc /mnt/gentoo/proc
# mount --rbind /sys /mnt/gentoo/sys
# mount --make-rslave /mnt/gentoo/sys
# mount --rbind /dev /mnt/gentoo/dev
# mount --make-rslave /mnt/gentoo/dev

On entre dans la nouvelle Gentoo

# chroot /mnt/gentoo /bin/bash
# source /etc/profile
# export PS1="(chroot) ${PS1}"
# mkdir /boot
# mount /dev/mmcblk0p2 /boot

On la met à jour, on lit les nouvelles et on choisi son profil (comme j'ai téléchargé l'archive 'hardened', le profil 'hardened' est déjà sélectionné).

# emerge --sync
# eselect news read
# eselect profile list
# emerge --ask --verbose --update --deep --newuse @world

La variable USE, dans le fichier make.conf, permet de sculpter votre Gentoo selon vos besoin. Liste des valeurs disponibles :
https://www.gentoo.org/support/use-flags/#global

Si vous utilisez emacs, il faut l'installer dans votre nouvel environnement

# emerge -a emacs
# emacs /etc/portage/make.conf

Je n'utilise ni l'interface graphique, ni le son, ni la wifi ni le serveur d'impression

USE="-X -cups hardened lm_sensors -sound -wifi"

Un peu de localisation

# echo "Europe/Paris" > /etc/timezone
# emerge --config sys-libs/timezone-data
# emacs /etc/locale.gen

fr_FR.UTF-8 UTF-8
fr_FR ISO-8859-1
fr_FR@euro ISO-8859-15

# locale-gen
# eselect locale list

Sélectionnez l'UTF-8

# eselect locale set 6
# env-update && source /etc/profile && export PS1="(chroot) $PS1"

Il est temps d'installer les sources du noyau Linux

# emerge --ask sys-kernel/gentoo-sources

Installez pciutils pour avoir des informations sur votre configuration matériel grâce à la commande 'lspci -k', ces informations seront nécessaire pour la configuration du noyau.

# emerge --ask sys-apps/pciutils

Configurons le noyau:

# cd /usr/src/linux
# make menuconfig ou "make localmodconfig"

-*- Enable the block layer --->
Partition Types --->
[*] Advanced partition selection
[*] EFI GUID Partition support

Processor type and features --->
[*] Symmetric multi-processing support
[*] Intel Low Power Subsystem Support
Processor family (Intel Atom) --->
( ) Opteron/Athlon64/Hammer/K8
( ) Intel P4 / older Netburst based Xeon
( ) Core 2/newer Xeon
(X) Intel Atom
( ) Generic-x86-64
Preemption Model (No Forced Preemption (Server)) --->
(X) No Forced Preemption (Server)
( ) Voluntary Kernel Preemption (Desktop)
( ) Preemptible Kernel (Low-Latency Desktop)
[X] Machine Check / overheating reporting
[X] Intel MCE Features
[ ] AMD MCE Features
[*] EFI runtime service support
[*] EFI stub support
[ ] EFI mixed-mode support
[*] Built-in kernel command line
(root=PARTUUID=db0de721-9da0-449c-923d-68cff3635cd3)

Executable file formats / Emulations --->
[*] IA32 Emulation

[*] Networking support --->
Networking options --->
[*] Network packet filtering framework (Netfilter) --->

Device Drivers --->
Generic Driver Options --->
[*] Maintain a devtmpfs filesystem to mount at /dev
[ ] Automount devtmpfs at /dev, after the kernel mounted the rootfs
<*> NVM Express block device
SCSI device support --->
<*> SCSI disk support
[*] Network device support --→
[*] Ethernet driver support --->
[*] Intel devices
<*> Intel(R) 82575/82576 PCI-Express Gigabit Ethernet support
[*] Intel(R) PCI-Express Gigabit adapters HWMON support
-*- Hardware Monitoring support --->
<*> Intel Core/Core2/Atom temperature sensor
HID support --->
-*- HID bus support
<*> Generic HID driver
[*] Battery level reporting for HID devices
USB HID support --->
<*> USB HID transport layer
[*] USB support --->
<*> xHCI HCD (USB 3.0) support
<*> EHCI HCD (USB 2.0) support
<*> OHCI HCD (USB 1.1) support
<*> MMC/SD/SDIO card support --->
<*>     SDHCI support on PCI bus

Firmware Drivers --->
EFI (Extensible Firmware Interface) Support --->
<*> EFI Variable Support via sysfs

File systems --->
<*> Second extended fs support
<*> The Extended 3 (ext3) filesystem
<*> The Extended 4 (ext4) filesystem
DOS/FAT/NT Filesystems --->
<*> MSDOS fs support
<*> VFAT (Windows-95) fs support
Native Language support --->
[*] NLS ISO 8859-1 (Latin 1; Western European Languages)
Pseudo Filesystems --->
[*] /proc file system support
[*] Tmpfs virtual memory file system support (former shm fs)

Compilation et installation du noyau :

# make -j3 && make modules_install
# make install
# emerge --ask sys-kernel/linux-firmware

Configuration du système (nom d'hôte, config réseau, mot de passe root, disposition du clavier) :

# emacs /etc/fstab

UUID=6472-9F0C/bootvfatdefaults,noatime0 2
UUID=61f2ab02-4055-463f-9331-db046af0ba19noneswapsw0 0
UUID=deefc02d-376e-43fd-a0f0-fde3e4a6c89c/ext4noatime0 1

# emacs /etc/conf.d/hostname

hostname="IG-88"

# emacs /etc/conf.d/net

config_eno1="192.168.0.6/24"
routes_eno1="default via 192.168.0.1"

config_enp1s0="10.0.0.1/24"

# cd /etc/init.d
# ln -s net.lo net.eno1
# rc-update add net.eno1 default
# passwd
# emacs /etc/conf.d/keymaps

Installation d'outils système :

# emerge --ask app-admin/sysklogd
# rc-update add sysklogd default
# emerge --ask sys-process/cronie
# rc-update add cronie default
# emerge --ask sys-apps/mlocate
# rc-update add sshd default

Installation de GRUB 2 :

# echo 'GRUB_PLATFORMS="efi-64"' >> /etc/portage/make.conf
# emerge --ask --verbose sys-boot/grub:2
# grub-install --target=x86_64-efi --efi-directory=/boot --removable
# grub-mkconfig -o /boot/grub/grub.cfg

L'installation est terminée :

# exit
# cd
# umount -l /mnt/gentoo/dev{/shm,/pts,}
# umount -R /mnt/gentoo
# reboot

Dans mon cas, au redémarrage, le 'disque' se nomme dorénavant mmcblk1 au lieu de mmcblk0.
Lorsque le menu de GRUB s'affiche, appuyez sur 'e' pour éditer la commande et éviter un kernel panic.
Une fois démarré, relancer la configuration de GRUB :

# grub-mkconfig -o /boot/grub/grub.cfg